// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "TUBaseCharacter.generated.h"

class UCameraComponent;
class USpringArmComponent;
class USphereComponent;
class UTUHealthComponent;
class UTextRenderComponent;
class UTUWeaponComponent;


UCLASS()
class THEMUP_API ATUBaseCharacter : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	ATUBaseCharacter(const FObjectInitializer& ObjInit);

	// Called every frame
	virtual void Tick(float DeltaTime) override;
	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
	UFUNCTION(BlueprintCallable, Category = "Movement")
	float GetMovementDirection() const;
	UFUNCTION(BlueprintCallable, Category = "Movement")
	virtual bool IsRunning() const;
	void SetPlayerColor(const FLinearColor& Color);

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	virtual void OnDeath();
	virtual void OnHealthChanged(float Health);
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
	UCameraComponent* CameraComponent;
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
	USpringArmComponent* SpringArmComponent;
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
	UTUHealthComponent* HealthComponent;
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
	UTextRenderComponent* HealthTextComponent;
	UPROPERTY(EditDefaultsOnly, Category = "Animation")
	UAnimMontage* DeathAnimMontage;
	UPROPERTY(EditDefaultsOnly, Category = "Damage")
	FVector2D LandedDamageVelocity = FVector2D(900.0f, 1200.0f);
	UPROPERTY(EditDefaultsOnly, Category = "Damage")
	FVector2D LandedDamage = FVector2D(10.0f, 100.0f);
	UPROPERTY(EditDefaultsOnly, Category = "Damage")
	FName MaterialColorName = "Paint Color";
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
	UTUWeaponComponent* WeaponComponent;
private:
	void MoveForward(float Amount);
	void MoveRight(float Amount);
	void LookUp(float Amount);
	void TurnAround(float Amount);
	void OnStartRunning();
	void OnStopRunning();
	UFUNCTION()
	void OnGroundLanded(const FHitResult& Hit);

	bool WantsToRun = false;
	bool IsMovingForward = false;



};
